package FunctionPackage;

import BookListPackage.BookList;

import java.util.Scanner;

public class Search implements Function {
    @Override
    public void work(BookList bookList) {
        System.out.println("查找图书！");
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入要查找的书名:");
        String bookName = scanner.nextLine();

        for (int i = 0; i < bookList.amount; i++) {
            if (bookName.equals(bookList.books[i].getBookName())) {
                System.out.println(bookList.books[i]);
                return;
            }
        }
        System.out.println("--------未找到该书!!!--------");
    }
}
